package com.situ.rd.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.situ.rd.service.RdYearmonthService;
import com.situ.rd.entity.RdYearmonth;
import com.situ.test.*;
/**
 * RdYearmonth的路由接口服务
 * 
 * @author胡文
 *
 */
//
@RestController
public class RdYearmonthController {

	/** RdYearmonthService服务 */
	@Autowired
	private RdYearmonthService rdYearmonthService;
	
	/**
	 * 查询所有RdYearmonth数据的方法
	 * @param value
	 * @return
	 */
	@GetMapping(value = "/RdYearmonth/query", produces = {"application/json;charset=UTF-8"})
	public ResponseData query(RdYearmonth value) {

		return ResponseData.ok().putDataValue("list",rdYearmonthService.find(value));
	}
	
	/**
	 * 通过id查询RdYearmonth数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "/RdYearmonth/queryById/{id}", produces = {"application/json;charset=UTF-8"})
	public ResponseData queryById(@PathVariable(name="id") Integer id) {
		 return ResponseData.ok().putDataValue("obj",rdYearmonthService.findOne(id));
	}
	
	/**
	 * 插入RdYearmonth属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "/RdYearmonth/save")
	public ResponseData save(RdYearmonth value) {
		return ResponseData.ok().putDataValue("obj", rdYearmonthService.saveNotNull(value));
	}
	
	/**
	 * 更新RdYearmonth属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "/RdYearmonth/update", produces = {"application/json;charset=UTF-8"})
	public ResponseData update(RdYearmonth value) {
		return ResponseData.ok().putDataValue("obj",rdYearmonthService.updateNotNullById(value));
	}

	/**
	 * 通过id删除RdYearmonth数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "/RdYearmonth/delById/{id}", produces = {"application/json;charset=UTF-8"})
	public ResponseData delById(@PathVariable(name="id") Integer id) {
		return ResponseData.ok().putDataValue("obj",rdYearmonthService.deleteById(id));
	}


    //带分页的查询全部
//@ApiOperation("带分页的查询全部")
/*
    @RequestMapping(value = "/RdYearmonth/queryPage", produces = {"application/json;charset=UTF-8"})
    public ResponseData queryPage(RdYearmonth value,
                             @RequestParam(defaultValue = "1",required = false) int pageNum ,
                             @RequestParam(defaultValue = "5",required = false) int pageSize) {

	    PageHelper.startPage(pageNum, pageSize);
        List<SysMight> list = sysMightService.find2(value);
    PageInfo pageInfo = new PageInfo<SysMight>(list,5);

        return ResponseData.ok()
        // .putDataValue("list", list)
        .putDataValue("pageInfo",pageInfo);
        }
 */
}
